//
//  ViewController.m
//  ZhiBo
//
//  Created by huangtie on 2017/10/30.
//  Copyright © 2017年 huangtie. All rights reserved.
//

#import "ViewController.h"
#import "ZBLiveViewController.h"
#import "ZBLiveChannel.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *buttonLive = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonLive.size = CGSizeMake(200, 40);
    buttonLive.top = 100;
    buttonLive.centerX = self.view.width / 2;
    [buttonLive setTitle:@"进入直播" forState:UIControlStateNormal];
    buttonLive.layer.cornerRadius = 5;
    buttonLive.clipsToBounds = YES;
    buttonLive.layer.borderColor = UICOLOR_ARGB(0xff4168a9).CGColor;
    buttonLive.layer.borderWidth = .5;
    [buttonLive setTitleColor:UICOLOR_ARGB(0xff4168a9) forState:UIControlStateNormal];
    buttonLive.titleLabel.font = FONT_NORMAL_14;
    [buttonLive addBlockForControlEvents:UIControlEventTouchUpInside block:^(id  _Nonnull sender) {
        [[ZBLiveChannel sharedInstance] loginChannel:^(BOOL isSuccess, NSString *errorMsg) {
            if (isSuccess) {
                ZBLiveViewController *controller = [[ZBLiveViewController alloc] init];
                controller.supportedInterfaceOrientation = UIInterfaceOrientationPortrait;
                controller.videoQuality = 2;
                [self presentViewController:controller animated:YES completion:nil];
            }else{
                [self.view makeToast:errorMsg];
            }
        }];
        

    }];
    [self.view addSubview:buttonLive];
    
}



@end
